package com.lzh.persevere.model.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.lzh.persevere.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * <p>
 * 请求日志表（目前用于记录请求日志）
 * </p>
 *
 * @author luzhiheng
 * @since 2024-08-13
 */
@TableName("sys_operation_log")
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Table(name = "sys_operation_log", indexes = {})
public class SysOperationLog extends BaseEntity {

    /**
     * 请求接口
     */
    @Column(name = "request_interface", columnDefinition = "varchar(1024) COMMENT '请求接口'", nullable = false)
    private String requestInterface;

    /**
     * 请求方式
     */
    @Column(name = "request_way", columnDefinition = "varchar(50) COMMENT '请求方式'", nullable = false)
    private String requestWay;

    /**
     * IP地址
     */
    @Column(name = "ip", columnDefinition = "varchar(100) COMMENT 'IP地址'", nullable = false)
    private String ip;

    /**
     * IP属地
     */
    @Column(name = "ip_source", columnDefinition = "varchar(500) COMMENT 'IP属地'", nullable = false)
    private String ipSource;

    /**
     * 平台
     */
    @Column(name = "platform", columnDefinition = "varchar(200) COMMENT '平台'", nullable = false)
    private String platform;

    /**
     * 浏览器
     */
    @Column(name = "browser", columnDefinition = "varchar(200) COMMENT '浏览器'", nullable = false)
    private String browser;

    /**
     * 请求耗时（毫秒）
     */
    @Column(name = "request_time", columnDefinition = "bigint COMMENT '请求耗时（毫秒）'", nullable = false)
    private Long requestTime;

    /**
     * 操作模块
     */
    @Column(name = "operation_module", columnDefinition = "varchar(255) COMMENT '操作模块'")
    private String operationModule;

    /**
     * 具体操作事件
     */
    @Column(name = "operation_events", columnDefinition = "varchar(255) COMMENT '具体操作事件'")
    private String operationEvents;

    /**
     * 操作URL
     */
    @Column(name = "operation_url", columnDefinition = "varchar(255) COMMENT '操作URL'")
    private String operationUrl;

    /**
     * 操作附带数据
     */
    @Column(name = "operation_data", columnDefinition = "varchar(255) COMMENT '操作附带数据'")
    private String operationData;

    /**
     * 操作状态：0操作异常 1操作正常
     */
    @Column(name = "operation_status", columnDefinition = "int COMMENT '操作状态：0操作异常 1操作正常'")
    private Integer operationStatus;

    /**
     * 操作所在IP
     */
    @Column(name = "operation_ip", columnDefinition = "varchar(255) COMMENT '操作所在IP'")
    private String operationIp;

    /**
     * 操作结果
     */
    @Column(name = "operation_result", columnDefinition = "varchar(255) COMMENT '操作结果'")
    private String operationResult;

    /**
     * 请求耗时
     */
    @Column(name = "request_time_consume", columnDefinition = "bigint COMMENT '请求耗时'")
    private Long requestTimeConsume;

}
